<template>
  <div v-loading="loading">
    <div class="top">
      <p>一站式知识产权服务平台</p>
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane label="商标" name="商标">
          <div style="margin-top: 15px;text-align: center;">
            <el-input placeholder="请输入您要查询的商标名称" class="input-with-select">
              <el-button slot="append" @click="dialogFormVisible = true">查询</el-button>
            </el-input>
          </div>
        </el-tab-pane>
        <el-tab-pane label="版权" name="版权">
          <div style="margin-top: 15px;text-align: center;">
            <el-input placeholder="请输入您要查询的版权名称" class="input-with-select">
              <el-button slot="append" @click="dialogFormVisible = true">查询</el-button>
            </el-input>
          </div>
        </el-tab-pane>
        <el-tab-pane label="专利" name="专利">
          <div style="margin-top: 15px;text-align: center;">
            <el-input placeholder="请输入您要查询的专利名称" class="input-with-select">
              <el-button slot="append" @click="dialogFormVisible = true">查询</el-button>
            </el-input>
          </div>
        </el-tab-pane>
      </el-tabs>

      <vue-particles
        color="#fff"
        :particleOpacity="0.7"
        :particlesNumber="90"
        shapeType="circle"
        :particleSize="5"
        linesColor="#fff"
        :linesWidth="1"
        :lineLinked="true"
        :lineOpacity="0.4"
        :linesDistance="150"
        :moveSpeed="2"
        :hoverEffect="true"
        hoverMode="grab"
        :clickEffect="true"
        clickMode="push"
        class="lizi"
      >
      </vue-particles>

   <!--   color: String类型。默认'#dedede'。粒子颜色。
      particleOpacity: Number类型。默认0.7。粒子透明度。
      particlesNumber: Number类型。默认80。粒子数量。
      shapeType: String类型。默认'circle'。可用的粒子外观类型有："circle","edge","triangle", "polygon","star"。
      particleSize: Number类型。默认80。单个粒子大小。
      linesColor: String类型。默认'#dedede'。线条颜色。
      linesWidth: Number类型。默认1。线条宽度。
      lineLinked: 布尔类型。默认true。连接线是否可用。
      lineOpacity: Number类型。默认0.4。线条透明度。
      linesDistance: Number类型。默认150。线条距离。
      moveSpeed: Number类型。默认3。粒子运动速度。
      hoverEffect: 布尔类型。默认true。是否有hover特效。
      hoverMode: String类型。默认true。可用的hover模式有: "grab", "repulse", "bubble"。
      clickEffect: 布尔类型。默认true。是否有click特效。
      clickMode: String类型。默认true。可用的click模式有: "push", "remove", "repulse", "bubble"。-->
    </div>


    <div class="content">
      <div class="title">
        <img src="../assets/image/titleL.png" width="500" alt="" title=""/>
        <span>专区服务</span>
        <img src="../assets/image/titleR.png" width="500" alt="" title=""/>
      </div>
      <div class="fw fw1">
        <div class="left">
          <p>商标注册</p>
          <el-input
            placeholder="请输入您要查询的商标名称"
            suffix-icon="el-icon-search"
            @focus="dialogShow('商标')">
          </el-input>
        </div>
        <div class="right">
          <div class="sbLC">
            <img src="../assets/image/zqfw.png" width="700" alt="" title=""/>
            <div class=" display-flex space-between ">
              <div>商标注册</div><div>提交注册</div><div>受理通知书</div><div>商标注册证书</div>
            </div>
          </div>
          <div class="sbList">
            <el-tabs :tab-position="tabPosition" v-model="activeName1" @tab-click="handleClick1">
              <el-tab-pane :label="classify.name"
                           :name="classify.name"
                           v-for="(classify,index) in shangBiaoALclassify"
                           :key="index">
                <div class="sbList">
                  <div class="sb1 display-flex justify-content align-items" v-for="(list,index) in shangBiaoALListData" :key="index">
                    <img :src="list.image" width="190" alt="" title=""/>
                    <div class="sb1Show">{{list.name}}</div>
                  </div>
                </div>
              </el-tab-pane>
            </el-tabs>
          </div>
        </div>
      </div>
      <div class="fw fw2">
        <div class="left">
          <p>版权注册</p>
          <el-input
            placeholder="请输入您要查询的版权名称"
            suffix-icon="el-icon-search"
            @focus="dialogShow('版权')">
          </el-input>
        </div>
        <div class="right">
          <div class="sbLC">
            <img src="../assets/image/zqfw.png" width="700" alt="" title=""/>
            <div class=" display-flex space-between ">
              <div>版权注册</div><div>提交注册</div><div>受理通知书</div><div>版权注册证书</div>
            </div>
          </div>
          <div class="sbList">
            <el-tabs :tab-position="tabPosition" v-model="activeName2" @tab-click="handleClick2">
              <el-tab-pane :label="classify.name"
                           :name="classify.name"
                           v-for="(classify,index) in banQuanALclassify"
                           :key="index">
                <div class="sbList">
                  <div class="sb1 display-flex justify-content align-items" v-for="(list,index) in banQuanALListData" :key="index">
                    <img :src="list.image" width="190" alt="" title=""/>
                    <div class="sb1Show">{{list.name}}</div>
                  </div>
                </div>
              </el-tab-pane>
            </el-tabs>
          </div>
        </div>
      </div>
      <div class="fw fw3">
        <div class="left">
          <p>专利注册</p>
          <el-input
            placeholder="请输入您要查询的专利名称"
            suffix-icon="el-icon-search"
            @focus="dialogShow('专利')">
          </el-input>
        </div>
        <div class="right">
          <div class="sbLC">
            <img src="../assets/image/zqfw.png" width="700" alt="" title=""/>
            <div class=" display-flex space-between ">
              <div>专利注册</div><div>提交注册</div><div>受理通知书</div><div>专利注册证书</div>
            </div>
          </div>
          <div class="sbList">
            <el-tabs :tab-position="tabPosition" v-model="activeName3" @tab-click="handleClick3">
              <el-tab-pane :label="classify.name"
                           :name="classify.name"
                           v-for="(classify,index) in zhuanLiALclassify"
                           :key="index">
                <div class="sbList">
                  <div class="sb1 display-flex justify-content align-items" v-for="(list,index) in zhuanLiALListData" :key="index">
                    <img :src="list.image" width="190" alt="" title=""/>
                    <div class="sb1Show">{{list.name}}</div>
                  </div>
                </div>
              </el-tab-pane>
            </el-tabs>
          </div>
        </div>
      </div>
    </div>
    <div class="hzqy">
      <div>
        <div class="title">
          <img src="../assets/image/titleL2.png" width="500" alt="" title=""/>
          <span>合作企业</span>
          <img src="../assets/image/titleR2.png" width="500" alt="" title=""/>
        </div>

        <el-carousel :interval="4000" type="card" height="450px" :autoplay="false" indicator-position="none">
          <el-carousel-item v-for="(list,index) in heZuoQiYeData" :key="index">
            <el-card class="box-card">
              <div class="text item">
                <img :src="list.image" height="56" alt="" title=""/>
                <p>{{list.name}}</p>
                <p>{{list.description}}</p>
              </div>
            </el-card>
          </el-carousel-item>
        </el-carousel>
      </div>
    </div>
    <div class="content SBZS">
      <div class="title">
        <img src="../assets/image/titleL.png" width="500" alt="" title=""/>
        <span>商标展示</span>
        <img src="../assets/image/titleR.png" width="500" alt="" title=""/>
      </div>
      <el-tabs v-model="activeName4" @tab-click="handleClick4">
        <el-tab-pane :label="classify.name"
                     :name="classify.name"
                     v-for="(classify,index) in shangBiaoALclassify"
                     :key="index">
          <el-row :gutter="20">
            <el-col :span="6" v-for="(list,index) in shangBiaoALListData2" :key="index">
              <div class="grid-content">
                <el-card class="box-card">
                  <div class="text item">
                    <img :src="list.image" width="190" :alt="list.name" title=""/>
                    <p>{{list.name}}</p>
                    <p>{{list.description}}</p>
                  </div>
                </el-card>
              </div>
            </el-col>
          </el-row>
        </el-tab-pane>
      </el-tabs>
    </div>
    <!--查询弹出框-->
    <el-dialog title="免费查询" :visible.sync="dialogFormVisible">
      <el-form :model="form">
        <el-form-item>
          <el-input prefix-icon="el-icon-search" v-model="form.name" placeholder="请输入查询内容"></el-input>
        </el-form-item>
        <el-form-item>
          <el-input prefix-icon="el-icon-mobile" v-model="form.phone" placeholder="请输入手机号码"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="hide">免费查询</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  export default {
    name: "home",
    data() {
      return {
        loading: false,
        // datevalue1: '',
        activeName: '商标',
        activeName1: '',
        activeName2: '',
        activeName3: '',
        activeName4: '',
        heZuoQiYeID: 0,
        heZuoQiYeData: [],
        tabPosition: 'left',   //tab切换居左

        dialogFormVisible: false,
        form: {
          name: '',
          phone:'',
        },

        shangBiaoALclassify:[],
        shangBiaoALListData:[],
        shangBiaoALListData2:[],

        banQuanALclassify:[],
        banQuanALListData:[],

        zhuanLiALclassify:[],
        zhuanLiALListData:[],
      }
    },

    methods: {
      handleClick(tab, event) {
        // console.log(tab, event);
      },

      handleClick1(tab) {
        console.log(tab.index);
        var id = this.shangBiaoALclassify[tab.index].id;
        this.shangBiaoALlist(id,1)
      },
      handleClick4(tab) {
        console.log(tab.index);
        var id = this.shangBiaoALclassify[tab.index].id;
        this.shangBiaoALlist(id,2)
      },
      handleClick2(tab) {
        console.log(tab.index);
        var id = this.banQuanALclassify[tab.index].id;
        this.banQuanALlist(id,1)
      },
      handleClick3(tab) {
        console.log(tab.index);
        var id = this.zhuanLiALclassify[tab.index].id;
        this.zhuanLiALlist(id,1)
      },

      getBannerIDList() {
        let that = this;
        this.$http
          .post(this.$api.default.bannerIDList,{type : 'banner'},)
          .then(res => {
            // console.log('数据', res)


          }).catch(error => {
        })
          .then(() => {
          });
      },
      //每屏列表(获取合作企业详情)
      getClassifyData(id) {
        let that = this;
        this.$http
          .post(this.$api.default.MP,{cid : id},)
          .then(res => {
            // console.log('数据', res);
            for(var i = 0;i < res.data.length;i++){
              res.data[i].image = that.$api.default.url_ + res.data[i].image
            }
            that.heZuoQiYeData = res.data;
            // console.log(that.heZuoQiYeData)
          }).catch(error => {
        })
          .then(() => {
          });
      },
      //每屏分类(获取合作企业ID)
      getClassifyList() {
        this.heZuoQiYeID = localStorage.getItem('heZuoQiYeID');
        if(this.heZuoQiYeID){
          this.getClassifyData(this.heZuoQiYeID)
          return
        }
        console.log('请求LOGO');
        let that = this;
        this.$http
          .post(this.$api.default.MPFL,{type : 'screen'},)
          .then(res => {
            // console.log('数据', res);
            //合作企业ID
            if(res.data[3].name == '合作企业'){
              that.heZuoQiYeID = res.data[3].id;
              localStorage.setItem('heZuoQiYeID',res.data[3].id);
              that.getClassifyData(that.heZuoQiYeID)
            }
            //商标服务ID
            if(res.data[2].name == '商标服务'){
              // that.shangBiaofwID = res.data[2].id;
              localStorage.setItem('shangBiaofwID',res.data[2].id);
              // that.getClassifyData(that.shangBiaofwID)
            }
            //商标介绍ID
            if(res.data[1].name == '商标介绍'){
              // that.shangBiaojsID = res.data[1].id;
              localStorage.setItem('shangBiaojsID',res.data[1].id);
              // that.getClassifyData(that.shangBiaojsID)
            }
            //设计服务ID
            if(res.data[0].name == '设计服务'){
              // that.sheJifwID = res.data[0].id;
              localStorage.setItem('sheJifwID',res.data[0].id);
              // that.getClassifyData(that.sheJifwID)
            }

          }).catch(error => {
        })
          .then(() => {
          });
      },

      //弹框
      hide(){
        if(!this.form.name){
          this.toast('error', '查找内容为空', true);
          return;
        }
        if(!this.check.isMobile(this.form.phone)){
          this.toast('error', '请正确填写手机号码', true);
          return;
        }
        let that = this;

        this.$http
          .post(this.$api.default.message,{name: that.activeName,ipr_name: that.form.name,phone: that.form.phone},)
          .then(res => {
            console.log('数据', res);

            this.toast('success', '提交成功', true);
            this.dialogFormVisible = false;
            this.form.name = '';
            this.form.phone = '';

          }).catch(error => {
        })
          .then(() => {
          });
      },
      dialogShow(type){
        this.activeName = type;
        this.dialogFormVisible = true
      },
      //====
      //案例--商标案例
      shangBiaoAL(){
        let that = this;
        this.$http
          .post(this.$api.default.category,{type:'trademark'},)
          .then(res => {
            // console.log('数据', res)
            that.shangBiaoALclassify = res.data;
            //设置初始值
            that.activeName1 = res.data[0].name
            that.activeName4 = res.data[0].name

            // that.shangBiaoALlist(res.data[0].id,3)
            that.shangBiaoALlist(res.data[0].id,1)
            that.shangBiaoALlist(res.data[0].id,2)

          }).catch(error => {
        })
          .then(() => {
          });
      },
      //案例--商标列表
      shangBiaoALlist(id,who){
        var size = 4;
        if(who == 1){
          size = 4
        }else if(who == 2){
          size = 8
        }
        let that = this;
        this.$http
          .post(this.$api.default.SB,{page: 1,cid: id,listRows: size})
          .then(res => {
            // console.log('数据', res);

            for(var i = 0;i < res.data.data.length;i++){
              res.data.data[i].image = that.$api.default.url_ + res.data.data[i].image
            }
            if(who == 1){
              that.shangBiaoALListData = res.data.data;
            }else if(who == 2){
              that.shangBiaoALListData2 = res.data.data;
            }else if(who == 3){
              that.shangBiaoALListData = res.data.data;
              that.shangBiaoALListData2 = res.data.data;
            }
          }).catch(error => {
        })
          .then(() => {
          });
      },

      //案例--版权案例
      banQuanAL(){
        let that = this;
        this.$http
          .post(this.$api.default.category,{type:'copyright'},)
          .then(res => {
            // console.log('数据', res)
            that.banQuanALclassify = res.data;
            //设置初始值
            that.activeName2 = res.data[0].name
            // that.activeName2 = res.data[0].name

            that.banQuanALlist(res.data[0].id,1)

          }).catch(error => {
        })
          .then(() => {
          });
      },
      //案例--版权列表
      banQuanALlist(id,who){
        // console.log(id)
        let that = this;
        this.$http
          .post(this.$api.default.BQ,{page: 1,cid: id,listRows: 4})
          .then(res => {
            // console.log('数据', res);

            for(var i = 0;i < res.data.data.length;i++){
              res.data.data[i].image = that.$api.default.url_ + res.data.data[i].image
            }
            if(who == 1){
              that.banQuanALListData = res.data.data;
            }else if(who == 2){
              that.banQuanALListData2 = res.data.data;
            }else if(who == 3){
              that.banQuanALListData = res.data.data;
              that.banQuanALListData2 = res.data.data;
            }
          }).catch(error => {
        })
          .then(() => {
          });
      },

      //案例--专利案例
      zhuanLiAL(){
        let that = this;
        this.$http
          .post(this.$api.default.category,{type:'Patent'},)
          .then(res => {
            // console.log('数据', res)
            that.zhuanLiALclassify = res.data;
            //设置初始值
            that.activeName3 = res.data[0].name
            // that.activeName2 = res.data[0].name
            that.zhuanLiALlist(res.data[0].id,1)
          }).catch(error => {
        })
          .then(() => {
          });
      },
      //案例--专利列表
      zhuanLiALlist(id,who){
        let that = this;
        this.$http
          .post(this.$api.default.ZL,{page: 1,cid: id,listRows: 4})
          .then(res => {
            // console.log('数据', res);
            for(var i = 0;i < res.data.data.length;i++){
              res.data.data[i].image = that.$api.default.url_ + res.data.data[i].image
            }
            if(who == 1){
              that.zhuanLiALListData = res.data.data;
            }else if(who == 2){
              that.zhuanLiALListData2 = res.data.data;
            }else if(who == 3){
              that.zhuanLiALListData = res.data.data;
              that.zhuanLiALListData2 = res.data.data;
            }

          }).catch(error => {
        })
          .then(() => {
          });
      },
    },
    //生命周期 - 创建完成（可以访问当前this实例）
    created() {
      // this.getBannerIDList();
      this.getClassifyList();
      //商标案例
      this.shangBiaoAL();
      //版权案例
      this.banQuanAL();
      //专利案例
      this.zhuanLiAL();
    },
    //生命周期 - 挂载完成（可以访问DOM元素）
    mounted() {}, //生命周期 - 创建之前
    beforeCreate() {},
    //生命周期 - 挂载之前
    beforeMount() {},
    //生命周期 - 更新之前
    beforeUpdate() {},
    //生命周期 - 更新之后
    updated() {},
    //生命周期 - 销毁之前
    beforeDestroy() {},
    //生命周期 - 销毁完成
    destroyed() {},
    //如果页面有keep-alive缓存功能，这个函数会触发
    activated() {},
  }
</script>

<style scoped>
  .top{
    height: 500px;
    min-width: 1200px;
    /*background: #ddd;*/
    padding-top: 113px;
    /*background: url("../assets/image/banner.png") no-repeat;*/
    /*background-position: center center;*/
    background-size: cover;
    box-sizing: border-box;
    position: relative;
    background: linear-gradient(-35deg, #152B5F, #1A336D);
  }
  .top p{
    font-size: 50px;
    font-family: Microsoft YaHei;
    font-weight: bold;
    color: #FFFFFF;
    line-height: 60px;
    text-align: center;
    margin-bottom: 60px;
  }
  .content{
    width: 1200px;
    margin: auto;
  }
  .top >>> .el-tabs__nav-wrap::after{
    /*background-color: transparent;*/
    display: none;
  }
  .top >>> .el-tabs__item{
    width: 98px;
    height: 40px;
    border-radius: 6px;
    font-size: 24px;
    color: #fff;
    line-height: 40px;
    text-align: center;
    padding: 0px;
  }
  .top >>> .el-tabs__item.is-active{
    background: #FFFFFF;
    color: #1890FF;
  }
  .top >>> .el-tabs__active-bar{
    display: none;
  }
  .top >>> .el-tabs__nav{
    float: none;
    /*margin: auto;*/
    text-align: center;
  }
  .top >>> .el-tabs__content{
    width: 1200px;
    margin: auto;
    z-index: 2;
  }
  .top >>> .el-input-group{
    width: 800px;
    margin: auto;
  }
  .title{
    text-align: center;
    font-size: 32px;
    font-family: Microsoft YaHei;
    font-weight: bold;
    color: #1890FF;
    /*line-height: 84px;*/
    margin: 70px 0;
  }
  .title span{
    display: inline-block;
    margin: 0 20px;
  }
  .top >>> .el-input-group__append{
    background-color: #1890FF;
    color: #FFFFFF;
    font-size: 22px;
    border: none;
  }
  .top >>> .el-input__inner{
    height: 60px;
    font-size: 18px;
  }
  .fw{
    height: 500px;
    border-radius: 10px;
    border: 1px solid #B7B7B7;
    overflow: auto;
    margin-bottom: 60px;
    position: relative;
  }
  .fw .left{
    width: 300px;
    height: 500px;
    float: left;
  }
  .fw1 .left{
    background: url("../assets/image/bg_blue.png") no-repeat;
    background-position: center center;
    background-size: cover;

  }
  .fw2 .left{
    background: url("../assets/image/bg_z.png") no-repeat;
    background-position: center center;
    background-size: cover;
  }
  .fw3 .left{
    background: url("../assets/image/bg_orange.png") no-repeat;
    background-position: center center;
    background-size: cover;
  }
  .left p{
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    color: #FFFFFF;
    margin-top: 50px;
    margin-bottom: 25px;
  }
  .left .el-input{
    width: 244px;
    margin: auto;
    display: block;
    margin-bottom: 100px;
  }
  .right{
    width: calc(100% - 300px);
    height: 500px;
    float: left;
  }
  .sbLC{
    height: 240px;
    padding-top: 40px;
    box-sizing: border-box;
  }
  .sbLC img{
    display: block;
    margin: auto;
  }
  .sbLC > div{
    width: 670px;
    margin: auto;
    margin-left: 120px;
  }
  .sbLC > div > div:nth-child(2){
    margin-left: 30px;
  }
  .sbLC > div > div:nth-child(3){
    margin-left: 20px;
  }
  .sbList{
    height: 260px;
    overflow: auto;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 260px;
    z-index: 2;
  }
  .sbList >>> .el-tabs--left  .el-tabs__header.is-left{
    width: 300px;
    margin-right: 0px;
  }
  .sbList >>> .el-tabs--left .el-tabs__active-bar.is-left{
    display: none;
  }
  .sbList >>>.el-tabs__nav-wrap::after{
    background-color: transparent;
  }
  .sbList >>> .el-tabs__content{
    height: 260px;
    width: calc(100% - 300px);
  }
  .sbList >>> .el-tabs__nav{
    width: 244px;
    height: 231px;
    background: #FFFFFF;
    border-radius: 10px;
    margin: auto;
    padding: 20px;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
  }
  .sbList >>> .el-tabs--left .el-tabs__item.is-left{
    width: 33%;
    margin-bottom: 8px;
    cursor: pointer;
    float: left;
  }
  .sbList .sb1{
    float: left;
    width: 25%;
    height: 100%;
    position: relative;
    border: 1px solid #B7B7B7;
    box-sizing: border-box;
  }
  .sbList .sb1 .sb1Show{
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 40px;
    background: #1890FF;
    font-size: 18px;
    color: #FFFFFF;
    line-height: 40px;
    text-align: center;
    display: none;
  }
  .sbList .sb1:hover{
    border: 1px solid #1890FF;
  }
  .sbList .sb1:hover .sb1Show{
    display: block;
  }
  .el-carousel__item h3 {
    color: #475669;
    font-size: 18px;
    opacity: 0.75;
    line-height: 300px;
    margin: 0;
  }
  .el-carousel__item:nth-child(2n) {
    background-color: #99a9bf;
  }
  .el-carousel__item:nth-child(2n+1) {
    background-color: #d3dce6;
  }
  .hzqy{
    background: #1890FF;
    min-width: 1200px;
    margin: auto;
  }
  .hzqy .title{
    color: #fff;
    padding-top: 70px;
  }
  .hzqy > div{
    width: 1200px;
    margin: auto;
  }
  .hzqy >>> .el-carousel__item{
    background: transparent;
  }
  .hzqy >>> .el-card{
    /*height: 350px;*/
    height: 400px;
    padding: 20px;
    box-sizing: border-box;
  }
  .hzqy >>> .el-carousel__item--card{
    /*width: 30%;*/
  }

  .hzqy >>> .el-carousel__arrow--left,
  .hzqy >>> .el-carousel__arrow--right{
    /*background: #fff;*/
    box-shadow: 0px 0px 4px 3px #ddd;
    background: #1890FF;
  }
  .box-card img{
    display: block;
    margin: auto;
    margin-bottom: 30px;
  }
  .box-card p:nth-of-type(1){
    text-align: center;
    margin-bottom: 20px;
  }
  .SBZS >>> .el-tabs__nav-scroll{
    padding-left: 50px;
  }
  .SBZS >>> .el-tabs__item{
    font-size: 18px;
  }
  .SBZS >>> .el-tabs__header{
    margin-bottom: 60px;
  }
  .SBZS .el-col-6{
    margin-bottom: 30px;
  }
  .lizi{
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
  }
</style>
